/* 请求函数配置 */
import DEVICEREPAIR from 'service/apis/deviceRepair'
import Request from 'service/request'

// 投诉单接口 -------------------------------------------------------
// 获取投诉单的详情页数据: GET
export async function complaintDetail({ id }) {
    return Request({
        url: DEVICEREPAIR.COMPLAINT_DETAIL + '/' + id,
    })
}

// 获取投诉单的列表信息: POST
export async function complaintList(params) {
    return Request({
        url: DEVICEREPAIR.COMPLAINT_LIST + '?ver=' + (new Date()).getTime(),
        data: params,
        method: 'POST',
    })
}

// 整改单接口 -------------------------------------------------------
// 获取整改单的详情页数据: GET
export async function rectificationDetail({ id }) {
    return Request({
        url: DEVICEREPAIR.RECTIFICATION_DETAIL + '/' + id + '?ver=' + (new Date()).getTime(),
    })
}

// 整改单详情的投诉操作: PUT
export async function rectificationComplatint(params) {
    return Request({
        url: DEVICEREPAIR.RECTIFICATION_COMPLAINT,
        data: params,
        method: 'PUT',
    })
}

// 获取整改单所有状态: GET
export async function rectificationStatusAll() {
    return Request({
        url: DEVICEREPAIR.RECTIFICATION_STATUS_ALL,
    })
}

// 获取整改单的列表信息: POST
export async function rectificationList(params) {
    return Request({
        url: DEVICEREPAIR.RECTIFICATION_LIST + '?ver=' + (new Date()).getTime(),
        data: params,
        method: 'POST',
    })
}

// 修改整改单的状态: PUT
export async function rectificationUpdateStatus(params) {
    return Request({
        url: DEVICEREPAIR.RECTIFICATION_UPDATE_STATUS,
        data: params,
        method: 'PUT',
    })
}

// 维修订单相关接口 -------------------------------------------------------
// 获取维修单（订单）信息: GET
export async function repairSingleMsg(params) {
    return Request({
        url: DEVICEREPAIR.REPAIR_SINGLE_MESSAGE,
        data: params,
    })
}

// 维修单列表: POST
export async function repairSingleList(params) {
    return Request({
        url: DEVICEREPAIR.REPAIR_SINGLE_LIST + '?ver=' + (new Date()).getTime(),
        data: params,
        method: 'POST'
    })
}

//  发起整改和投诉: POST
export async function rectionAddComplain(params) {
    return Request({
        url: DEVICEREPAIR.RECTIFICATION_ORCOPLANT,
        data: params,
        method: 'POST'
    })
}

// 维修设备订单 -------------------------------------------------------
// 获取设备维修管理订单详情: GET
export async function repairChickDetail({ orderId }) {
    return Request({
        url: DEVICEREPAIR.REPAIR_CHECK_DETAIL + '/' + orderId + '?ver=' + (new Date()).getTime(),
    })
}

// 获取维修单状态: GET
export async function repairStatus() {
    return Request({
        url: DEVICEREPAIR.REPAIR_STATUS,
    })
}

// 修改维修单状态: POST
export async function repairUpdate(params) {
    return Request({
        url: DEVICEREPAIR.REPAIR_UPDATE,
        data: params,
        method: 'POST',         
    })
}

// 获取设备维修管理单记录: POST
export async function repairRecord(params) {
    return Request({
        url: DEVICEREPAIR.REPAIR_RECORD,
        data: params,
        method: 'POST',
    })
}

// 流程节点: GET
export async function getOrderProcess({ id }) {
    return Request({
        url: DEVICEREPAIR.ORDER_PROCESS + '/' + id + '?ver=' + (new Date()).getTime(),
    })
}
